Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(util): add markdown format functions to util #2314

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

HTGAzureX1212
Copy link
Contributor

Closes #2279.

This draft PR explores a potential implementation for markdown formatting functions. It is expected that the implementation would be iterated on for a bit before this is actually merged into main.

@HTGAzureX1212 HTGAzureX1212 added w-do-not-merge PR is blocked or deferred w-unapproved Proposal for change has *not* been approved by @twilight-rs/core. w-needs-more-docs Needs more documentation before being worked on. labels Feb 14, 2024
@HTGAzureX1212 HTGAzureX1212 self-assigned this Feb 14, 2024
@github-actions github-actions bot added c-util Affects the util crate t-feature Addition of a new feature labels Feb 14, 2024
Copy link
Member

@Gelbpunkt Gelbpunkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing spoilers and code blocks (perhaps even more that I didn't think of).

twilight-util/src/format.rs Outdated Show resolved Hide resolved
@HTGAzureX1212
Copy link
Contributor Author

Do you think we need to add the H1, H2, H3, ... formatting?

@laralove143
Copy link
Member

Do you think we need to add the H1, H2, H3, ... formatting?

yes, i think this should support all of discord's supported markdown, including named links and timestamps

@HTGAzureX1212
Copy link
Contributor Author

Do you think we need to add the H1, H2, H3, ... formatting?

yes, i think this should support all of discord's supported markdown, including named links and timestamps

Promptly added.

fn strikethrough(self) -> Self;
}

impl Format for String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer formatters like twilight_mention::fmt::MentionFormat and twilight_model::user::DiscriminatorDisplay over extension methods.

twilight-util/src/format.rs Show resolved Hide resolved
@@ -15,6 +15,9 @@
#[cfg(feature = "builder")]
pub mod builder;

#[cfg(feature = "format")]
pub mod format;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub mod format;
pub mod fmt;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-util Affects the util crate t-feature Addition of a new feature w-do-not-merge PR is blocked or deferred w-needs-more-docs Needs more documentation before being worked on. w-unapproved Proposal for change has *not* been approved by @twilight-rs/core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatter macros
4 participants